package com.sdonkey.score.controller;


import com.sdonkey.score.bean.LoginReturnBean;
import com.sdonkey.score.model.AdvertiserBankBean;
import com.sdonkey.score.service.IAccountCentralService;
import com.sdonkey.score.service.ILoginService;
import com.sdonkey.score.util.MD5;
import com.sdonkey.score.util.StaticVariableUtil;
import com.sdonkey.score.vo.ResultErrorVo;
import com.sdonkey.score.vo.ResultSuccessVo;
import com.sdonkey.score.vo.ResultVo;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 基本信息
 * 
 * @author MengXue
 * @version1.0
 */
@SuppressWarnings("unused")
@Controller
@RequestMapping(method = RequestMethod.POST)
public class AccountCentralAction {

	static Map<String, Object> cache = new HashMap<String, Object>();
	@Autowired
	private IAccountCentralService accountCentralService;
	@Autowired
	private ILoginService loginService;
//
//	@Autowired
//	private IRegisterService registerService;

	
	/**
	 * 基本信息
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/basicInfo", method = RequestMethod.POST)
	@ResponseBody
	public LoginReturnBean basicInfo(HttpServletRequest req, HttpServletResponse res, HttpSession session) throws Exception {

		LoginReturnBean loginReturnBean = (LoginReturnBean) req.getAttribute("advertiser");
		loginReturnBean = loginService.login(loginReturnBean.getDonkeyNum());
			session.setAttribute("advertiser", loginReturnBean);
			loginReturnBean.setCompanyLogoUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getCompanyLogo());
			loginReturnBean.setBusinessLicenceUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getBusinessLicence());
			loginReturnBean.setOrganizationCodeUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getOrganizationCode());
			
		
		return loginReturnBean;
	}
	

	/**
	 * 获取公司logo(单独添加 不被过滤)
	 * getCompanyLogo
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getCompanyLogo", method = RequestMethod.POST)
	@ResponseBody
	public LoginReturnBean getCompanyLogo(HttpServletRequest req, HttpServletResponse res, HttpSession session) throws Exception {

		LoginReturnBean loginReturnBean = (LoginReturnBean) req.getAttribute("advertiser");

			loginReturnBean = loginService.login(loginReturnBean.getCompanyName());
			session.setAttribute("advertiser", loginReturnBean);
			loginReturnBean.setCompanyLogoUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getCompanyLogo());
			loginReturnBean.setBusinessLicenceUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getBusinessLicence());
			loginReturnBean.setOrganizationCodeUrl(StaticVariableUtil.SHOW_IMG_PRE+ loginReturnBean.getOrganizationCode());
			
		
		return loginReturnBean;
	}
	
	/**
	 * 会员昵称去
	 * @param session
	 * @param nowName
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkMemberName", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo checkMemberName(HttpServletRequest req, HttpServletResponse res, HttpSession session, String nowName) throws Exception {
		LoginReturnBean loginReturnBean = (LoginReturnBean) req.getAttribute("advertiser");
		String name = loginReturnBean.getMemberName();// 数据已存在的name
		if (!nowName.equals(name)) {// 修改会员昵称时去重
			int count = accountCentralService.checkName(nowName);
			if (count > 0) {
				return new ResultErrorVo("*该昵称已存在");
			}
		}
		return new ResultSuccessVo("*昵称通过验证");

	}	
	/**
	 * 修改基本信息
	 * 
	 * @param session
	 * @param loginReturnBean
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/updateBasicInfo", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo updateInformation(HttpSession session,
//                                      LoginReturnBean loginReturnBean) throws Exception {
//
//		int result = accountCentralService.updateBasicInfo(loginReturnBean);
//
//		LoginReturnBean realloginReturnBean = loginService.login(loginReturnBean.getDonkeyNum());// 将最新的用户信息放入session中
//		session.setAttribute("advertiser", realloginReturnBean);
//		Map<String, String> map = new HashMap<String, String>();
//		map.put("advId", loginReturnBean.getAdvId());
//		map.put("checkStatus", "2");
//		accountCentralService.updateStatus(map);
//		if (result == 0) {
//			return new ResultErrorVo("*提交失败，请重新修改！");
//		}
//		session.removeAttribute("checkStatus");
//		session.setAttribute("checkStatus", "2");
//		LoginReturnBean myloginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
//
//		myloginReturnBean.setCompanyLogo(StaticVariableUtil.SHOW_IMG_PRE + myloginReturnBean.getCompanyLogo());
//		myloginReturnBean
//				.setBusinessLicenceUrl(StaticVariableUtil.SHOW_IMG_PRE + myloginReturnBean.getBusinessLicence());
//		myloginReturnBean
//				.setOrganizationCodeUrl(StaticVariableUtil.SHOW_IMG_PRE + myloginReturnBean.getOrganizationCode());
//		return new ResultSuccessVo("恭喜你，修改成功");
//	}

	/**
	 * 账号余额
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/balance", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> balance(HttpServletRequest req, HttpServletResponse res, HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) req
				.getAttribute("advertiser");
		/*String companyName=loginReturnBean.getCompanyName();
		 loginReturnBean = loginService.login(companyName);
		session.setAttribute("advertiser", loginReturnBean);*/		
		model.put("actualBalance", loginReturnBean.getActualBalance());//当前账户余额
		//获取当前广告余额
		double sum= accountCentralService.getAdvertiserBalance(loginReturnBean.getAdvId()); 	    
		model.put("advertiserBalance", sum);
				
		String spending=accountCentralService.totalSpending(loginReturnBean.getAdvId());
	    Double totalpay=Double.parseDouble(spending);
		model.put("spending", totalpay);
		
		model.put("totalConsumption", loginReturnBean.getTotalConsumption());
		return model;
	}

	/**
	 * 账号充值(页面加载时携带参数)
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/recharge", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> recharge(HttpServletRequest req, HttpServletResponse res, HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) req
				.getAttribute("advertiser");
		model.put("companyName", loginReturnBean.getCompanyName());
		model.put("openBank", loginReturnBean.getOpenBank());
	
		model.put("accountNumber", loginReturnBean.getAccountNumber());
		return model;
	}

	/**
	 * 充值,修改账户余额
	 * 
	 * @param session
	 * @param money
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/updateBalance", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo updateBalance(HttpSession session, String bankPhone, String money, String pwd, String phoneCode)
			throws Exception {
		LoginReturnBean loginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
		if (!pwd.equals("")) {
			pwd = MD5.encode(pwd);
			String scorePayPwd = loginReturnBean.getScorePayPwd();
			if (!pwd.equals(scorePayPwd)) {
				return new ResultErrorVo("*密码输入有误，请重新输入");
			}
		} else {
			// 判断手机验证码正确性 0 错误 2 失效
			int count = accountCentralService.checkPhoneCode(loginReturnBean.getAdvId(), bankPhone, phoneCode);
			if (count == 0) {
				return new ResultErrorVo("*验证码输入有误");
			} else if (count == 2) {
				return new ResultErrorVo("*验证码失效，请重新发送");
			}
		}

		String advId = loginReturnBean.getAdvId();
		String actualBalance = loginReturnBean.getActualBalance();
		String totalConsumption = loginReturnBean.getTotalConsumption();
		
		accountCentralService.saveRecharge(advId,money);
		int result = accountCentralService.updateBalance(advId, money, actualBalance, totalConsumption);
		loginReturnBean = loginService.login(loginReturnBean.getCompanyName());
		if (result == 0) {
			return new ResultErrorVo("*充值失败,请重新充值");
		}
		loginReturnBean = loginService.login(loginReturnBean.getDonkeyNum());
		session.setAttribute("advertiser", loginReturnBean);
		return new ResultSuccessVo("*充值成功");
	}

	/**
	 * 账户中心
	 * 
	 * @param req
	 * @param res
	 * @param session
	 * @param model
	 * @param email
	 * @return 
	 * @throws Exception
	 */
	@RequestMapping(value ="/financialCenter", method = RequestMethod.POST)
	@ResponseBody

	public LoginReturnBean financialCenter(HttpServletRequest req, HttpServletResponse res, HttpSession session, String email) throws Exception {

		LoginReturnBean loginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
		return loginReturnBean;


	}

	/**
	 * 更新密码
	 * 
	 * @param session
	 * @param oldPassword
	 * @param newPassword
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo alterPassword(HttpSession session, String oldPassword,
                                  String newPassword) throws Exception {
		LoginReturnBean LoginReturnBean = (com.sdonkey.score.bean.LoginReturnBean) session
				.getAttribute("advertiser");
		if (!MD5.encode(oldPassword).equals(LoginReturnBean.getPassword())) {
			return new ResultErrorVo("*旧密码填写错误");// 返回错误信息
		}
		int result = accountCentralService.newPassword(
				LoginReturnBean.getEmail(), MD5.encode(newPassword));
		if (result == 0) {
			return new ResultErrorVo("*修改失败，请重新修改");
		}
		session.setAttribute("password", newPassword);
		return new ResultSuccessVo("*修改成功");
	}

	/**
	 * 校验邮箱校验码
	 * 
	 * @param verCode
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/checkEmail", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo checkEmail(HttpSession session, String email, String verCode)
//			throws Exception {
//		// 验证码是否正确，验证码是否失效   0 错误  2  失效
//		int reslut = accountCentralService.checkVerificationCode(email, verCode);
//		session.setAttribute("email", email);
//		if (reslut == 0) {
//			return new ResultErrorVo("*验证码输入错误");
//		}else if(reslut ==2){
//			return new ResultErrorVo("*验证码失效，请重新发送");
//		}
//		return new ResultSuccessVo("*验证码输入正确");
//	}

	

	/**
	 * 校验新邮箱
	 * 
	 * @param session
	 * @param email
	 * @param newEmail
	 * @param verCode
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/checkNewEmail", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo checkNewEmail(HttpSession session, String newEmail, String verCode) throws Exception {
//		LoginReturnBean LoginReturnBean = (com.sdonkey.score.bean.LoginReturnBean) session.getAttribute("advertiser");
//		// 验证码是否正确，验证码是否失效 0 错误 2 失效
//		int reslut = accountCentralService.checkVerificationCode( newEmail, verCode);
//		if (reslut == 0) {
//			return new ResultErrorVo("*验证码输入错误");
//		} else if (reslut == 2) {
//			return new ResultErrorVo("*验证码失效，请重新发送");
//		} else {
//			// 验证通过时进行下一步(修改邮箱)
//			int res = accountCentralService.alterEmail(LoginReturnBean.getAdvId(), newEmail);
//			if (res == 0) {
//				return new ResultErrorVo("*修改异常，请重新修改");
//			}
//			session.setAttribute("email", newEmail);
//			return new ResultSuccessVo("修改成功");
//
//		}
//	}

	/**
	 * 给邮箱发送验证码
	 * @param session
	 * @param email 该邮箱为注册时的邮箱
	 * @param newEmail 该邮箱为修改后的新邮箱
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/sendEmailVerCode", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo sendEmailVerCode(HttpSession session, String email, String newEmail) throws Exception {
//
//		if (newEmail == null) {
//			accountCentralService.sendEmailVerCode(session, email);
//
//		} else {
//			if (registerService.checkemail(newEmail)) {
//				return new ResultErrorVo("*邮箱已注册，请重新输入邮箱");
//			} else {
//				accountCentralService.sendEmailVerCode(session, newEmail);
//			}
//		}
//		return new ResultSuccessVo("发送成功！请您查看邮箱");
//
//	}

	/**
	 * 获取账户信息
	 * 
	 * @param request
	 * @param session
	 * @param money
	 * @return
	 */
	@RequestMapping(value = "/getBankAccount", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> getBanksAccount(HttpServletRequest request,
                                               HttpSession session, String money) {
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("develop_user");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("accountName", loginReturnBean.getAccountName());
		map.put("accountNum", loginReturnBean.getAccountNumber());
		map.put("openBank", loginReturnBean.getOpenBank());
		return map;
	}

	/**
	 * 账号提现(页面加载时携带参数)
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/withdraw", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> withdraw(HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("advertiser");
		model.put("bankName", loginReturnBean.getBankName());
		model.put("openBank", loginReturnBean.getOpenBank());
	
		model.put("accountNumber", loginReturnBean.getAccountNumber());
		return model;
	}

	/**
	 * 提现金额(具体提现操作)
	 * 
	 * @param session
	 * @return
	 */

//	@RequestMapping(value = "/drawCash", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo drawCash(HttpSession session, String money) {
//		String advId = (String) session.getAttribute("advId");
//		LoginReturnBean loginReturnBean = (LoginReturnBean) session
//				.getAttribute("advertiser");
//		String actualBalance = loginReturnBean.getActualBalance();
//		if(actualBalance==null){
//			actualBalance="0";
//		}
//		Double m = Double.parseDouble(money);
//		Double a = Double.parseDouble(actualBalance);
//
//		if(a>=m){
//			int flag = accountCentralService.insertDrawCash(advId, money);
//			int tflag = -1;
//			if (flag > 0) {
//				tflag = accountCentralService.updateActualBalance(advId, money,
//						actualBalance);
//			}
//			if (flag > 0 && tflag > 0) {
//				loginReturnBean = loginService.login(loginReturnBean.getDonkeyNum());
//				session.setAttribute("advertiser", loginReturnBean);
//				return new ResultSuccessVo("提现成功");
//			} else {
//				return new ResultErrorVo("*提现失败，请稍后重试");
//			}
//		}else{
//			return new ResultErrorVo("*余额不足，请重新输入金额！");
//		}
//
//
//
//	}

	/**
	 * 获取邮箱和密码(页面加载时携带参数)
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	
	@RequestMapping(value = "/gainEmailAndPwd", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> gainEmailAndPwd(HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("advertiser");
		String email = loginReturnBean.getEmail();
		int first = email.lastIndexOf("@"); 
		String newMail=email.substring(0,2) + "****" + email.substring(first-2);//取@前两位换*号 
		model.put("newMail", newMail);		
		model.put("email", email);		
		String pwd=(String) session.getAttribute("password");
		model.put("pwd",pwd);

		return model;
	}
	
//	@RequestMapping(value = "/existEmail", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo checkEmail(HttpSession session, String email) throws Exception {
//		if(!registerService.checkemail(email)){
//			return new ResultErrorVo("*该邮箱未注册");
//		}
//		return new ResultSuccessVo("邮箱验证通过");
//	}
//
	/**
	 * 获取用户名(页面加载时携带参数)
	 * 
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/gainName", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> gainName(HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("advertiser");
		model.put("memberName", loginReturnBean.getMemberName());
		
		return model;
	}
	

     /**
      * 设置微积分支付密码
      * @param session
      * @param payPwd
      * @return
      * @throws Exception
      */
	@RequestMapping(value = "/setPayPwd", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo setPayPwd(HttpSession session, String payPwd) throws Exception {
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("advertiser");
		String password=(String) session.getAttribute("password");
		if(payPwd.equals(password)){
			return new ResultErrorVo("*不与登录密码一致");
		}	
	     payPwd= MD5.encode(payPwd);
		int result=accountCentralService.setPayPassword(loginReturnBean.getAdvId(),payPwd);
		if (result == 0) {
			return new ResultErrorVo("*发送失败，稍后请重新发送");
		}
		
		return new ResultSuccessVo("恭喜你，修改成功");
		
	}
		
	/**
	 * 发送手机验证码
	 * @param session
	 * @param payPwd
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/sendPhoneCode", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo sendPhoneCode(HttpSession session, String bankPhone) throws Exception {
//		LoginReturnBean loginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
//		String verCode = RandomUtil.random(6);
//		try {
//			SendMessageUtil.sendMessage(bankPhone, verCode); // 发送验证码
//
//			int result = accountCentralService.insertPhoneCode(loginReturnBean.getAdvId(), bankPhone, verCode); // 保存验证码
//			if (result == 0) {
//				return new ResultErrorVo("*发送失败，稍后请重新发送");
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//			return new ResultErrorVo("*发送失败，稍后请重新发送");
//		}
//		return new ResultSuccessVo("发送成功，请及时查收");
//
//	}
	
	/**
	 * 保存用户绑定的银行卡信息
	 * @param session
	 * @param payPwd
	 * @return
	 * @throws Exception
	 */
//	@RequestMapping(value = "/saveBankInfo", method = RequestMethod.POST)
//	@ResponseBody
//	public ResultVo saveBankInfo(HttpSession session, AdvertiserBankBean advertiserBankBean) throws Exception {
//		LoginReturnBean loginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
//		String advId = loginReturnBean.getAdvId();
//		String bankPhone = advertiserBankBean.getBankPhone();
//		String phoneCode = advertiserBankBean.getPhoneCode();
//
//		advertiserBankBean.setAdvId(advId);
//		session.setAttribute("advertiserBankBean", advertiserBankBean);
//		// 判断手机验证码正确性 0 错误  2 失效
//		int count = accountCentralService.checkPhoneCode(advId, bankPhone, phoneCode);
//		if (count == 0) {
//			return new ResultErrorVo("*验证码输入有误");
//		} else if (count == 2) {
//			return new ResultErrorVo("*验证码失效，请重新发送");
//
//		}
//		String scorePayPwd = loginReturnBean.getScorePayPwd();
//		String bankPayPwd = advertiserBankBean.getBankPayPwd();
//		bankPayPwd = MD5.encode(bankPayPwd);
//		if (!scorePayPwd.equals(bankPayPwd)) {
//			return new ResultErrorVo("*密码输入有误");
//		}
//		int result = accountCentralService.saveBankInfo(advertiserBankBean);
//
//		if (result == 0) {
//			return new ResultErrorVo("保存失败，请重新输入");
//		}
//
//		return new ResultSuccessVo("恭喜你，保存成功");
//
//	}
	
	
	/**
	 * 获取银行卡信息
	 * @param session
	 * @param payPwd
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getBankInfo", method = RequestMethod.POST)
	@ResponseBody
	public Map<String,Object> getBankInfo(HttpSession session) throws Exception {
		LoginReturnBean loginReturnBean = (LoginReturnBean) session
				.getAttribute("advertiser");
		String advId=loginReturnBean.getAdvId();
		List<AdvertiserBankBean> list=accountCentralService.getBankInfo(advId);
		String realMoney=(String) session.getAttribute("money");
		String scorePayPwd=loginReturnBean.getScorePayPwd();
		
		Double mon = Double.parseDouble(realMoney);
		 NumberFormat nf = new DecimalFormat("##,###.00");
		String money = nf.format(mon);
		
		Map<String,Object> map=new HashMap<String,Object>();//将list,money 放入map中返回前台
		map.put("list", list);
		map.put("money", money);
		map.put("realMoney", realMoney);
		
		map.put("scorePayPwd", scorePayPwd);
	  return map;
		
		
	}
	
	/**
	 * 将充值金额放入session中
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/saveMoney", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo saveMoney(HttpSession session, String money) throws Exception {
		//Double mon = Double.parseDouble(money);
		session.setAttribute("money", money);		
		return new ResultSuccessVo("金额保存成功");
	}


	/**
	 * 判断是否已经设置支付密码
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/judgePayPwd", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> judgePayPwd(HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		LoginReturnBean loginReturnBean = (LoginReturnBean) session.getAttribute("advertiser");
		String pwd=loginReturnBean.getScorePayPwd();
		if(StringUtils.isEmpty(pwd)){
			pwd="0";
		}else{
			pwd="1";
		}
		model.put("scorePayPwd",pwd );
		return model;
	}	
	/**
	 * 将银行名和图片存放在session中
	 * @param session
	 * @param count
	 * @param bankName
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/setBankImg", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo setBankImg(HttpSession session, String count, String bankName, String money) throws Exception {
		session.setAttribute("count", count);
		session.setAttribute("bankName", bankName);
		session.setAttribute("money", money);
		return new ResultSuccessVo("保存成功");
	}	
	/**
	 * 获取银行名和图片
	 * @param session
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/gainBankImg", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> gainBankImg(HttpSession session) throws Exception {
		Map<String, Object> model = new HashMap<String, Object>();
		String count=(String) session.getAttribute("count");
		String bankName=(String) session.getAttribute("bankName");
		String money=(String) session.getAttribute("money");
		model.put("count",count );
		model.put("bankName",bankName);
		model.put("money",money);
		
		return model;
	}	

	
	
}
